home *** CD-ROM | disk | FTP | other *** search
/ CGI How-To / CGI HOW-TO.iso / chap2 / 2_1 / printenv.pl < prev    next >
Encoding:
Perl Script  |  1996-06-15  |  494 b   |  33 lines

  1. #!/bin/perl
  2.  
  3. # Send the output mime type to the server to know what output to handle
  4. print "Content-type: text/html\n\n";
  5.  
  6. print <<EOH;
  7. <HTML>
  8. <HEAD><TITLE>CGI Script How-To: Test Script</TITLE></HEAD>
  9. <BODY>
  10. EOH
  11.  
  12. # Call the subroutine
  13. &PrintEnv;
  14.  
  15. print "</BODY></HTML>\n";
  16. exit;
  17.  
  18. #
  19. # Define PrintEnv subroutine to print out all environment variables
  20. #
  21. sub PrintEnv
  22. {
  23.     local($name);
  24.     foreach $name (sort keys(%ENV))
  25.     {
  26.         print "<B>$name</B> = $ENV{$name}<BR>\n";
  27.     }
  28. }
  29.  
  30. #
  31. # end of printenv.pl
  32. #
  33.